﻿using Nancy;
using Nancy.Bootstrapper;
using Nancy.TinyIoc;

namespace DistpmbyNetCore.WEB.Bootstraper
{
    public class CustomBootstrapper: DefaultNancyBootstrapper
    {
        protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
        {
            pipelines.AfterRequest += (ctx) =>
            {
                ctx.Response.Headers.Add("Access-Control-Allow-Origin", "*");
                ctx.Response.Headers.Add("Access-Control-Allow-Headers", "authorization, content-type");
                ctx.Response.Headers.Add("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");

            };
            
            base.ApplicationStartup(container, pipelines);
            
        }
    }
}
